<?php
require_once(__PHY_LIB."/class/Item.class.php");

function area_title($nAreaID) {
	if (6 != strlen($nAreaID)) { return false; }
	$sTitle = '';
	/// 省 ///
	$nProvID = substr($nAreaID, 0, 2);
	if ('00' != $nProvID) {
		$nProvID .= '0000';
		$oOne = new Item();
		$oOne->cfgField("province AS title");
		$oOne->cfgTable("look_province");
		$oOne->cfgWhere("provinceid='{$nProvID}'");
		$oOne->load();
		$sTitle .= ' '.$oOne->get('title');
	}
	/// 市 ///
	$nCityID = substr($nAreaID, 2, 2);
	if ('00' != $nCityID) {
		$nCityID = substr($nAreaID, 0, 4).'00';
		$oOne = new Item();
		$oOne->cfgField("city AS title");
		$oOne->cfgTable("look_city");
		$oOne->cfgWhere("cityid='{$nCityID}'");
		$oOne->load();
		$sTitle .= ' '.$oOne->get('title');
	}
	/// 区 ///
	if ('00' != substr($nAreaID, 4, 2)) {
		$oOne = new Item();
		$oOne->cfgField("area AS title");
		$oOne->cfgTable("look_area");
		$oOne->cfgWhere("areaid='{$nAreaID}'");
		$oOne->load();
		$sTitle .= ' '.$oOne->get('title');
	}
	/// 返回 ///
	if (strlen($sTitle)) {
		return substr($sTitle, 1);
	}
	else {
		return false;
	}
}
?>
